var common = require('../../../utils/mr_xu/common.js')
var api = require("../../../utils/mr_xu/api_url.js").api
const app = getApp()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    remark: '',
    carImageList: [],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {

    let id = options.id

    if (!id) {
      app.wxToast.error('订单id错误')
      return
    }
    let that = this
    that.setData({
      id: id
    })
  },

  edit_remark: function(res) {
    this.setData({
      remark: res.detail.value
    })
  },
  next: function() {
    let that = this
    wx.showLoading({
      title: '上传中',
    })
    var images = []
    for (let i in that.data.carImageList) {
      images.push({ image: that.data.carImageList[i].image})
    }
    app.http.post(api.receive_quest_order,{
      data:{
        id: that.data.id,
        findImageLst: images,
        findRemark: that.data.remark
      }
    }).then(res => {
      wx.navigateTo({
        url: './order_info?id=' + that.data.id,
      })
      wx.hideLoading()
    }).catch(res => {
      wx.showToast({
        title: res.msg,
        icon:'none'
      })
    })
  },
  imagesChange(e) {

    let images = e.detail
    this.setData({
      carImageList: images
    })

  },
})